<template>
  <div>
    <el-form>
      <el-form-item>
        <el-input v-model="form.loginName" placeholder="用户名"></el-input>

      </el-form-item>
      <el-form-item>
        <el-input placeholder="请输入密码" v-model="form.password" show-password></el-input>
      </el-form-item>

      <el-form-item>
        <el-button type="primary" @click="Login">保存</el-button>
        <el-button>取消</el-button>
      </el-form-item>
    </el-form>
  </div>


</template>
<script>
  import index from '@/components/index'
  import Cookies from "js-cookie";

  export default {
    name: 'login',
    data() {
      return {
        form: {
          loginName: '',
          password: ''
        }
      };
    },

    methods: {
      Login() {
        var loginSysUserDTO = this.form;
        ;

        this.$post('/card/api/login', this.$qs.parse(loginSysUserDTO))
          .then((response) => {
            this.$message('登录成功');
            //Cookies.set('_cardToken', response.id);
            //否则就跳到默认的首页
            this.$router.push({
              name: 'index'
            })
          })
          .catch(response => {
            console.log(response)
          })
      }


    }
  }
</script>
